{template 'common/header'}
{template 'common'}
<div class="main">
	<ul class="nav nav-tabs">
	        <li><a href="{php echo $this->createWebUrl('manage');}">活动管理</a></li>
        <li><a href="{php echo url('platform/reply/post',array('m'=>'ewei_money','id'=>$_GPC['rid']));}">编辑活动</a></li>
        
        <li class="active"><a href="{php echo $this->createWebUrl('awardlist',array('rid' => $_GPC['rid']));}">中奖名单</a></li>
		<li><a href="{php echo $this->createWebUrl('rank',array('rid' => $_GPC['rid']));}">排行榜</a></li>
	</ul>
	
	 <div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
        	<input type="hidden" name="m" value="ewei_money" />
        	<input type="hidden" name="do" value="awardlist" />
	    	<input type="hidden" name="rid" value="{$_GPC['rid']}" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
				<div class="col-sm-8 col-lg-9">
					<input class="form-control" name="keywords" id="" type="text" value="{$_GPC['keywords']}" placeholder="可查询SN码,手机号">
				</div>
                         
			</div>
			
				<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
				<div class="col-sm-8 col-lg-9">
							<select name="status" class="form-control" style="float:left">
                                        <option value="">全部</option>
                                        <option value="1">未发放</option>
                                        <option value="2">已发放</option>
                                        <option value="3">已消费</option>
                                    </select>
				</div>
                                <div class=" col-xs-12 col-sm-2 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
			
 			<div class="form-group">
			</div>
		</form>
	</div>
 
    </div>
    
		<div style="padding: 0 15px 0  15px;">
		  <div class="row-fluid">
                                <div class="span8 control-group">
                                    <a class="btn btn-default" href="{php echo $this->createWebUrl('dda', array('rid'=>$rid))}"><i class="icon-download-alt"></i>导出SN码和兑奖信息</a>
                                    <a class="btn btn-default" href="{php echo $this->createWebUrl('awardlist', array('rid'=>$rid))}">全部</a>
                                    <a class="btn btn-default" href="{php echo $this->createWebUrl('awardlist', array('rid'=>$rid,'status'=>2))}">未领取</a>
                                    <a class="btn btn-default" href="{php echo $this->createWebUrl('awardlist', array('rid'=>$rid,'status'=>1))}">已兑奖</a>
                                </div>
                            </div>

<!--                             <div class="alert">
    本次活动奖品总数：{$num1}个　 　抽中未兑换：{$num2}个　　抽中已兑换：{$num3}个 领取规则先到先得！
</div> -->
		</div>
	<div style="padding: 15px 15px 0  15px;" style="position:relative">
		<table class="table table-hover" style="position:relative">
			<thead class="navbar-inner">
				<tr><th>序号</th>
                                                <th>SN码</th>
                                                <th>奖品名称</th>
                                                <th>状态</th>
                                                <th width="120px">手机号</th>
                                                <th>姓名</th>
                                                <th>微信码</th>
                                                <th>中奖时间</th>
                                                <th>兑奖时间</th>
                                                <th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php $count = $start; ?>
				{loop $list $row}
				<tr>
				<?php $count++; ?>
				<td>{$count}</td>
                                                <td>{$row['award_sn']}</td>
                                                <td>{$row['name']}</td>
                                                <td>{if $row['status']==0}<span class="label label-default">未领取</span>{elseif $row['status']==1}<span class="label label-success">已兑奖</span>{else}<span class="label label-red">已兑奖</span>{/if}</td>
                                                <td>{$row['mobile']}</td>
                                                <td>{$row['nickname']}</td>
                                                <td>{$row['from_user']}</td>
                                                <td>{php echo date('Y/m/d H:i',$row['createtime']);}</td>
                                                <td>{if $row['consumetime'] == 0}未兑奖{else}{php echo date('Y/m/d H:i',$row['consumetime']);}{/if}</td>
                                                <td>

                                                                <a class="btn btn-default" href="#" onclick="drop_confirm('确认设置为未兑奖?','{php echo $this->createWebUrl('setstatus', array('status'=>0,'id'=>$row['id'],'rid'=>$row['rid']))}');"><i class="icon-ban-circle"></i> 未兑奖</a>
 
                                                                <a class="btn btn-default" href="#" onclick="drop_confirm('确认设置为已兑奖?','{php echo $this->createWebUrl('setstatus', array('status'=>1,'id'=>$row['id'],'rid'=>$row['rid']))}');"><i class="icon-ok-circle"></i> 已兑奖</a>

                                                        </ul>
                                                    </div>
                                                </td>
				</tr>
				{/loop}

			</tbody>
		</table>
		{$pager}
	</div>

</div>
<script>
$(".phone").click(function() {
	$(".phone").addClass('label-teal');
	$(".phone").text('显示手机号');
	obj=$(this);
	obj.text('加载中...');
	fans=obj.attr('data-fans');
	$.post("{php echo create_url('site/module', array('do' => 'getphone','name' => 'izcmoney','rid'=>$rid))}", { fans: fans},
	function(data){
		obj.removeClass('label-teal');
		obj.text(data);
	});

});
	function drop_confirm(msg, url){
    if(confirm(msg)){
        window.location = url;
    }
}
</script>
{template 'common/footer'}